package com.yt.demo.jedis;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;
import java.util.Set;

/**
 * 连接集群测试
 */
public class JedisTest2 {
    public static void main(String[] args) {
        Set<HostAndPort> set=new HashSet<>();
        set.add(new HostAndPort("192.168.109.100",6379));
        set.add(new HostAndPort("192.168.109.100",6380));
        set.add(new HostAndPort("192.168.109.100",6381));
        set.add(new HostAndPort("192.168.109.100",6389));
        set.add(new HostAndPort("192.168.109.100",6390));
        set.add(new HostAndPort("192.168.109.100",6391));

        JedisCluster jedisCluster=new JedisCluster(set);
        jedisCluster.set("aa","vv");
        System.out.println(jedisCluster.get("aa"));
        System.out.println(jedisCluster.get("a2"));
    }

}
